﻿/**********************************************************************************
 * Description:     
 * MemberVariable:
 * Functions:       
 * Modify information:     
 * 2008-8-5     New           DuYaoHui     Create Class
 * 
 * ********************************************************************************/
using System;

using Fjaspx.Common;
using Fjaspx.UI.Web;
namespace Fjaspx.UCenter
{
    public partial class Administrator_reg : UserPage
    {
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {}
        /// <summary>
        /// Handles the Click event of the Button_add control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Button_add_Click(object sender, EventArgs e)
        {

            string name = this.txtname.Value;
            string password = this.txtpassword.Value;
            string qq = "";
            string email = this.txtemail.Value;
            int age = 0;
            string sex = "";
            if (this.xingbie_0.Checked)
            {
                sex = this.xingbie_0.Value;
            }
            else { sex = this.xingbie_0.Value; }
            string pic = "";

            ___ROYcms_user_model.name = name;
            ___ROYcms_user_model.password = password;
            ___ROYcms_user_model.qq = qq;
            ___ROYcms_user_model.email = email;
            ___ROYcms_user_model.age = age;
            ___ROYcms_user_model.sex = sex;
            ___ROYcms_user_model.pic = pic;

            //默认可选参数组
            ___ROYcms_user_model.money = 0;
            ___ROYcms_user_model.quanxian = "Guest";
            ___ROYcms_user_model.username = name;
            ___ROYcms_user_model.RoleID = null;
            ___ROYcms_user_model.UgroupID = null;
            ___ROYcms_user_model.GUID =___WebConfig.GUID;
            ___ROYcms_user_model.login_time = DateTime.Now;

            if (yanzhengma.Value.Trim().ToUpperInvariant() == Session["code"].ToString())
            {
                if (___ROYcms_user_bll.Add(___ROYcms_user_model) != 1)
                {

                    ___ROYcms_user_model = ___ROYcms_user_bll.GetModel(this.txtname.Value);
                    Fjaspx.Common.Session.Add("user_id", ___ROYcms_user_model.bh.ToString().Trim());
                    Fjaspx.Common.Session.Add("user", ___ROYcms_user_model.name.Trim());

                    MessageBox.Show(this, "注册成功！");
                    if (Request["url"] != null)
                    {
                        Response.Redirect(___WebConfig.web_host+Request["url"]);
                    }
                    else { Response.Redirect("~/UCenter/default.aspx"); }
                }
                else { MessageBox.Show(this, "注册失败！"); }
            }
            else { MessageBox.Show(this, "验证码错误！"); }


        }
    }
}